<?php
	/*ini_set("display_errors","1");
	error_reporting(E_ALL);*/
	require_once("cClientePhone.php");		

	$tablaId 	= $_REQUEST['tablaId'];
	$aliasId 	= $tablaId;
	$objetivo 	= $_REQUEST['objetivo'];
	//echo "FLOTA FILTER: " . $tablaId;
	$datos 		= BykomClientePhone::Info_Alias($aliasId);
	$mysqli = new mysqli(HOST, USER, PASSWORD, DB); 
     if (mysqli_connect_errno()) {
     	$loginClassActual->errorCode = 1;
       	return  $loginClassActual;
     }	
	$SQL2 = " SELECT * From aliases a ";
	$SQL2.= " WHERE a.id ='". $aliasId . "'";
	if (!$mysqli->real_query($SQL2)) {
       	$loginClassActual->errorCode = 2;
       	return  $loginClassActual;
     }
    $resultado2 = BykomClientePhone::getResultado($mysqli);
    $cuentaFK 	= $resultado2->campo("cuentaFk",0);
    $ctas 	= BykomClientePhone::Cuentas_Cliente_Movil_DealerAlias($aliasId,$cuentaFK);
	$cuentaSeleccionada = $_REQUEST['cuentaSeleccionada'];
	
?>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Bykom Web Cliente</title>
	<link rel="stylesheet" href="css/phone.css" type="text/css" media="screen" charset="utf-8"/>	
</head>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle">
<div class="bodyContent">

<form name="selectMovil" action="dealerCell.php">
<input type="hidden" name="objetivo" value="<?=$objetivo?>"/>
<input type="hidden" name="aliasId" value="<?=$aliasId?>"/>

<div class="top">	
	
	<table width="100%">
		<tr>
			<td class="labelTop">
				<span class="textTop"> <?= $datos->campo('nombre', 0) ?>  </span>  
			</td>
            <td rowspan="2" width="105px" align="center" valign="middle">
            	<img src="images/WClogoTop.gif" border="0">
            </td>
		</tr>
		<tr>
			<td class="labelTop">Opciones: 
            	<span class="textTop"> <?= $ctas->cantidad();?>  </span> 
            </td>
		</tr>
	</table>
</div>
<div class="botonera">
	<table align="right" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td align="right"> 
        		<a href="welcomeCell.php" title="Salir/Logout"><img src="images/BTNexit.gif" border="0"/></a> 			
			</td>
		</tr>	
	</table>
</div>
<table>
	<tr>
		<td align="center">
			<span class="sectionTitle">Selecci&oacute;n de flota/m&oacute;vil</span>
		</td>
	</tr>
	<tr>
    	<td>&nbsp;</td>
    </tr>
	<tr>	
		<td>
			<select name='selectDealer' id='selectDealer'>;
    		<? 
    		for($i=0;$i<$ctas->cantidad();$i++) {
    			$selected = "";
    			if ($ctas->campo('id', $i) == $cuentaSeleccionada) {
    				$selected = "selected";
    			}
				echo "<option class='styleInput' value='". $ctas->campo('ES_FLOTA', $i).'|'.$ctas->campo('id', $i)."' " . $selected . ">".
						/*$ctas->campo('nombre', $i) .
						(($ctas->campo('nombreDos', $i) == '') ? "" : ("," . $ctas->campo('nombreDos', $i)));*/
						$ctas->campo('NOMBRE', $i);
					 "</option>";	
    		}
			?>	
    	    </select>
    	</td>
    </tr>
    <tr>
    	<td>&nbsp;</td>
    </tr>
    <tr>
		<td align="center">
			<input type="submit" class="button" value="- Seleccionar -"/>
		</td>
	</tr>
</table>
</form>

</div>
</td></tr></table>
</body>
</html>    	    
